//! 启动命令行
use clap::{Args, Parser, Subcommand};

/// Simple program to greet a person
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct WebCli {
    #[command(subcommand)]
    pub command: Option<Commands>,
}

#[derive(Debug, Subcommand)]
pub enum Commands {
    /// start server
    Run(RunArgs),
    /// init operate
    Init(InitArgs),
}

#[derive(Debug, Args)]
pub struct RunArgs {
    /// config file.
    #[arg(long, default_value_os = "application.yml")]
    pub config_file: String,
}

impl Default for RunArgs {
    fn default() -> Self {
        Self {
            config_file: "application.yml".to_owned(),
        }
    }
}

#[derive(Debug, Args)]
pub struct InitArgs {
    /// Name of the operate [db,super_user]
    pub name: String,
    /// config file.
    #[arg(long, default_value_os = "application.yml")]
    pub config_file: String,
}
